<%@ page pageEncoding="UTF-8"%>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
</head>
<body>
<p>显示Cookie的值：</p>
<%
    //JSP将请求默认是使用ISO-8859-1，而大多数浏览器都是以UTF-8编码发送请求数据.所以，如果不设置编码，那么就会导致乱码。
    request.setCharacterEncoding("UTF-8");

    Cookie[] cookies = request.getCookies();
    for (int i=0; i<cookies.length; i++){
        if(cookies[i].getName().equals("name")){
            out.println("Hello"+java.net.URLDecoder.decode(cookies[i].getValue(), "UTF-8"));
        }
    }
%>
</body>
</html>